/*
 * @Author: Wxx
 * @Date: 2022-02-28 09:57:51
 * @LastEditors: Wxx
 * @LastEditTime: 2022-02-28 10:12:08
 * @Description:
 */
import React, { Component } from "react";
import { observable, autorun } from "mobx";
var number = observable.box(10);
var name = observable.box("冰墩墩");
autorun(() => {
  console.log(number.get());
});
setTimeout(() => {
  name.set("雪绒线");
}, 3000);
autorun(() => {
  console.log(name.get());
});

// var obj = observable.map({
//   name: "小麦",
//   age: 18,
// });
// autorun(() => {
//   console.log(obj.get("name"));
// });
// setTimeout(() => {
//   obj.set("name", "小美");
// }, 3000);

var obj = observable({
  name: "小麦",
  age: 18,
});
autorun(() => {
  console.log(obj.name);
});
setTimeout(() => {
  obj.name = "小美";
}, 3000);
export default class mobx extends Component {
  render() {
    return <div>mobx</div>;
  }
}
